<template>
  <el-menu
    default-active="2"
    class="el-menu-vertical-demo"
    :router="true"
    :unique-opened= true >

    <el-menu-item index="/main/home">
      <i class="el-icon-menu"></i>
      <span slot="title">系统首页</span>
    </el-menu-item>

    <el-submenu index="1" :disabled="sh">
      <template slot="title">
        <i class="el-icon-medal-1"></i>
        <span>运动健康</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/data_query">数据查询</el-menu-item>
        <el-menu-item index="/main/data_analysis">数据分析</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="2" :disabled="ma">
      <template slot="title">
        <i class="el-icon-first-aid-kit"></i>
        <span>医疗服务</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/department_manage">科室管理</el-menu-item>
        <el-menu-item index="/main/hospital_manage">医院管理</el-menu-item>
        <el-menu-item index="/main/doctor_manage">医生管理</el-menu-item>
        <el-menu-item index="/main/login_chat_room">在线诊断</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="3" :disabled="sm">
      <template slot="title">
        <i class="el-icon-shopping-cart-full"></i>
        <span>商城管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/category_management">品类管理</el-menu-item>
        <el-menu-item index="/main/goods_manage">商品管理</el-menu-item>
        <el-menu-item index="/main/order_manage">订单管理</el-menu-item>
        <el-menu-item index="/main/after_sale_service">售后管理</el-menu-item>
        <el-menu-item index="/main/freight_template">运费模板</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="4" :disabled="cs">
      <template slot="title">
        <i class="el-icon-notebook-1"></i>
        <span>内容管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/column_manage">栏目管理</el-menu-item>
        <el-menu-item index="/main/consulting_manage">咨询管理</el-menu-item>
        <el-menu-item index="/main/audit_manage">审核列表</el-menu-item>
        <el-menu-item index="/main/advertising_manage">广告管理</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="5">
      <template slot="title">
        <i class="el-icon-collection-tag"></i>
        <span>数据统计</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/user_statistics">用户统计</el-menu-item>
        <el-menu-item index="/main/registration_statistics">挂号统计</el-menu-item>
        <el-menu-item index="/main/physical_examination_statistics">体检统计</el-menu-item>
        <el-menu-item index="/main/consultation_statistics">问诊统计</el-menu-item>
        <el-menu-item index="/main/sales_statistics">销售统计</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

    <el-submenu index="6" :disabled="ss">
      <template slot="title">
        <i class="el-icon-setting"></i>
        <span>系统管理</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="/main/user_list/用户列表">用户列表</el-menu-item>
        <el-menu-item index="/main/role_manage/角色管理">角色管理</el-menu-item>
        <el-menu-item index="/main/AccountManage/账号管理">账号管理</el-menu-item>
        <el-menu-item index="/main/ClosureManage/封禁管理">封禁管理</el-menu-item>
        <el-menu-item index="/main/OperationLog/操作日志">操作日志</el-menu-item>
      </el-menu-item-group>
    </el-submenu>

  </el-menu>
</template>

<script>
  export default {
    created() {
      let obj = JSON.parse(localStorage.getItem("admin"))
      let permit = obj.roleInfo.permit
      console.log(permit)
      if(permit.indexOf("sh") >= 0 ) {
        this.sh = false
      }
      if(permit.indexOf("ma") >= 0 ) {
        this.ma = false
      }
      if(permit.indexOf("sm") >= 0 ) {
        this.sm = false
      }
      if(permit.indexOf("cs") >= 0 ) {
        this.cs = false
      }
      if(permit.indexOf("ss") >= 0 ) {
        this.ss = false
      }
    },
    name: "Menu",
    methods: {
    },
    data(){
      return {
        sh : true,
        ma : true,
        cs : true,
        ss : true,
        sm : true,
      }
    }
  }
</script>

<style scoped>

</style>
